package com.qianxx.base.utils;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.qianxx.base.BaseAty;

/**
 * @author you.y
 */
public class LoginUtil {

	public static Class loginAty;

	public static Context context;
	/**
	 * 设置登录界面
	 */
	public static void setLoginAty(Class loginAty) {
		LoginUtil.loginAty = loginAty;
	}
	public static void jumpToLoginAty() {
		if (loginAty == null) {
			LogUtil.e("LoginUtil --- loginAty没有初始化");
			return;
		}
		Intent intent = new Intent(context, loginAty);
		context.startActivity(intent);
	}

	public static void jumpToLoginAty(BaseAty aty, int requestCode) {
		if (loginAty == null) {
			LogUtil.e("LoginUtil --- loginAty没有初始化");
			return;
		}
		Intent intent = new Intent(aty, loginAty);
		aty.startActivityForResult(intent, requestCode);
	}

	/**
	 * 是否已登录
	 */
	public static boolean isLogin() {
		String token = SPUtil.getInstance().getToken();
		return (!TextUtils.isEmpty(token));
	}

}
